import Vue from 'vue';
import App from './App';
import store from './store';

import HbbRequest, {
  ERROR_LOG_ADD
} from '@/api/api';
import { MINA_TYPE_NAME } from '@/config';

Vue.config.productionTip = false

App.mpType = 'app'

const app = new Vue({
  ...App,
  store,
})
app.$mount()

//系统错误捕获
Vue.config.errorHandler = (err, vm, info) => {
  console.log('监控异常')
  console.error('抛出全局异常', err, info);
  new HbbRequest(ERROR_LOG_ADD, {
  tableData: [
      {
      EntID: store.state.main.params.EntID || '0',
      UserID: store.state.main.params.UserID || '0',
      AppID: '@AppID',
      Secret: '@Secret',
      BSN: '@BSN',
      FbContent: err + ',' + info,
      FbType: 0,
      AppName: MINA_TYPE_NAME
      }
  ]
  }).send();
};
